# -*- coding: utf-8 -*- 
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/6/23
# @File : C - Sum of product of pairs.py

N = int(input())#只要一个循环就够了，画图竖着看性质
rate = [int(i) % 1000000007 for i in input().split()]
a = 0
x = 0
for i in range(N - 1):
    x += rate[i]
    x = x % 1000000007
    a += (x * rate[i + 1]) % 1000000007
print(a % 1000000007)


"""
求余规则：
(a + b) % p = (a % p + b % p) % p 

(a - b) % p = (a % p - b % p) % p 

(a * b) % p = (a % p * b % p) % p 

1x2+1x3+1x4+1x5
    2x3+2x4+2x5
        3x4+3x5
            4x5    
            
竖着看!!！每个都是后面一个数（提取出来看）乘前面数的和，再相加
"""